<%--
  Created by IntelliJ IDEA.
  User: Ssw
  Date: 2018-10-18
  Time: 9:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/js/bootstrap.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/js/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <%--日期控件--%>

    <style>
        body{
            width: 1325px;
            height:50%;
            overflow: auto;
        }
        *{
            background: #fafafa ;
            font-family: 楷体;
        }
        input{
            background: #fafafa
        }
        #seleAll select{
            width: 200px;
            height:30px;
        }
        #seleAll select option{
            width: 200px;
            height:30px;
        }
        #tt1{
            width: 200px;
            height:30px;
        }
        #tt2{
            width: 200px;
            height:30px;
        }
        #tt3{
            width: 200px;
            height:30px;
        }
        #tt4{
            width: 200px;
            height:30px;
        }
        #tt5{
            width: 200px;
            height:30px;
        }
        #tt6{
            width: 200px;
            height:30px;
        }
        #tt7{
            width: 200px;
            height:30px;
        }
        .test2{
            width: 380px;
            height: 30px;
        }
        .test{
            width:130px;
            height:30px;
            padding-left: 25px;
        }
        .xmap li{

            margin-left: 15px;
        }
        .xmbtest{

            border-bottom: 1px solid #afbdc9;
            font-size: 15px;
            text-align: center;
        }

        .xmbtest th{

            border: 0px solid black;
            font-size: 15px;
            text-align: center;
            border-bottom: 1px solid #afbdc9;
        }
        #xmbbody tr{
            border: 1px solid #afbdc9;
            font-size: 15px;
            text-align: center;
        }
        #xmbbody td{
            border: 0px solid black;

        }
        .chimaxe{
            width:450px;
            height:25px;
            font-size: 12px;
            padding-left: 10px;
            font-family: 楷体;

        }
        .chimache input{
            width: 20px;
            height:25px;

        }
        #onecolor td{
            background:#BEE9F0;
        }
       .hocolors:hover{

            background-color: lightgoldenrodyellow;
        }
        .fenye{

            width: 500px;
            border: 0px solid black;
            height: auto;
            text-align: center;
            position: absolute;
            left:250px;
            top:360px;
            /*margin-top: 350px;
            margin-left: 350px;*/
        }
        #colorlibrary tr{
            width: 198px;

        }
        #colorlibrary td{
            width: 196px;
            border-bottom: 1px solid #9dbdd6;
        }

        /*尺寸*/
        .cctable{
            width: 600px;
        }
        .cctest{
            border-bottom: 1px solid #afbdc9;
            font-size: 15px;
            text-align: center;
            width:600px;
        }

        .cctest td{
            width:180px;
            border: 0px solid black;
        }
        /*bom*/
        #bomtabone td{
            width: 138.4px;
            height:24.8px;
            border: 1px solid black;
            height: 15px;
            font-size: 12px;
        }
        #bomtabtwo td{
            width: 138.4px;
            height:24.8px;
            border: 1px solid black;
            height: 15px;
            font-size: 12px;
        }
        .bomfenye{
            width: 500px;
            height: 20px;

            border: 0px solid black;
            height: auto;
            text-align: center;
            position: absolute;
            left:350px;
            top:230px;
        }
        .bomfenye li{

            width:100px;
            height:20px;
            font-size: 10px;
        }
        .bomapptr{

        }
        .bomapptr td{
            width: 138.4px;
            height:24.8px;
            border: 0px solid black;
            height: 15px;
            font-size: 12px;
        }
    </style>
</head>
<body>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/Vue.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/vue.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/vue-resource.js"></script>

<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/vendor/Blob.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/vendor/Export2Excel.js"></script>

<div id="seleAll">
        <div style="width: 1325px;height: 200px; /*border:1px solid red*/" >
<form class="form-inline" role="form">

    <div class="test" style="color: red;"><b>客户</b> </div>
    <select class="form-control" @change="test()" ref="clid" >
        <option value="0">---请选择---</option>
    <option v-for="clientss in clientss" :value="clientss.clid" >{{clientss.clname}}</option>
    </select>

        <div class="test" style="color: red;">品牌</div>
        <select class="form-control" @change="test()" ref="brandid" >
            <option value="0">---请选择---</option>
            <option v-for="brandss in brandss" :value="brandss.brandid" >{{brandss.brandname}}</option>

        </select>

    <div class="test" style="color: red;" >季度</div>
    <select class="form-control"  ref="seaid" >
        <option value="0">---请选择---</option>
        <option v-for="seasonss in seasonss" :value="seasonss.seaid" >{{seasonss.seaname}}</option>

    </select>

    <div class="test" style="color: red;">版型</div>
    <select class="form-control"  ref="plaid">
        <option value="0">---请选择---</option>
        <option v-for="platess in platess" :value="platess.plaid" >{{platess.planame}}</option>

    </select>


    <div class="test" style="color: red;">接单日期</div>
    <input type="text" class="form-control test2" id="tt1" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})" >

    <div class="test" style="color: red;">版期</div>
    <input type="text" class="test2 form-control" id="tt2"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})"  >

    <div class="test" style="color: red;">状态</div>
    <select class="form-control"  id="ordstatus">
        <option value="0">---请选择---</option>
        <option value="正在开发" >正在开发</option>
        <option value="开发终止" >开发终止</option>
        <option value="开发完成" >开发完成</option>

    </select>
    <div class="test" style="color: red;">开发单号</div>
    <input type="text" class="test2 form-control" id="tt3" :value="uuid" readonly >

    <div class="test" style="color: red;">样板倍数</div>
    <input type="text" class="test2 form-control" id="tt4" onkeyup="value=value.replace(/[^\?\d.]/g,'')">

    <div class="test" style="color: red;">款号</div>
    <select class="form-control" @change="seleks()" ref="haoid">
        <option value="0">---请选择---</option>
        <option v-for="stylehaoss in stylehaoss" :value="stylehaoss.haoid">{{stylehaoss.haoname}}</option>
    </select>

    <div class="test" style="color: red;">款式</div>
    <select class="form-control"  ref="designid" >
        <option value="0">---请选择---</option>
        <option v-for="designss in designss" :value="designss.designid">{{designss.desname}}</option>
       <%-- <option v-for="stylehaoss in stylehaoss" :value="stylehaoss.haoid">{{stylehaoss.haoname}}</option>--%>
    </select>

    <div class="test" style="color: red;">跟单</div>
    <input type="text" class="test2 form-control" id="tt5" value="张三" readonly>

    <div class="test">生产厂家</div>
    <input type="text" class="test2 form-control" id="tt6" >
    <div class="test">备注</div>
    <input type="text" class="test2 form-control" id="tt7" >

</form>
    </div>
<div>
    <ul id="daohang" class="nav nav-pills xmap" style="width: 1325px; border-top: 3px solid steelblue;border-bottom:3px solid steelblue ">
        <li><a @click="ximaclick()">细码表</a></li><%--class="active"--%>
        <li><a @click="chicunclick()">尺寸</a></li>
        <li><a @click="bomclick()">BOM</a></li>
        <li><a @click="ylclick()">用料</a></li>
        <li><a href="#">档案</a></li>
    </ul>
    <%--细码表导航栏--%>
    <div id="ximadaohang" style="width: 1325px;height: 40px;">
        <button @click="seleAllSize()" type="button" class="btn btn-default" data-toggle="modal" data-target="#samodel"><span class="glyphicon glyphicon-folder-close"></span>  尺码</button>
        <button @click="addLine()" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus-sign"></span>  增行</button>

    </div>

    <%--细码表div--%>
    <div id="ximadiv" style="width: 1325px;height: 500px;border-top: 1px solid black;">
        <div style="width: 1325px;height: 500px; overflow: auto">
        <table  class="table table-striped xmbtable">
            <thead>


            <tr class="xmbtest">

                <%--style='width:100px;'--%>
            </tr>
            </thead>
            <tbody id="xmbbody">

            </tbody>
        </table>
        </div>

    </div>
    <%--尺寸表导航栏--%>
    <div style="width: 1325px;height: 40px;display: none" id="chicundaohang">
        <form id="filesub">
        <input type="file" id="filename" style="float: left">
        <button style="float: left" @click="fileduqu()" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus-sign"></span>导入尺寸表</button>
        </form>
    </div>
    <%--尺寸表div--%>
    <div style="width: 1325px;height: 500px;border-top: 1px solid black;display: none" id="chicundiv">
        <div style="width: 905px;height: 500px; overflow: auto">
            <table class="cctable table">
                <tr class="cctest">



                </tr>
                <tbody id="chicunbody">
                <tr v-for="clothArr in clothArr" class="cctest">
                    <td>{{clothArr.clothname}}</td>
                    <td></td>
                    <td>{{clothArr.clothrmark}}</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>

    <%--BOM导航栏--%>
    <div style="width: 1325px;height: 40px;display: none" id="bomdaohang">
        <button @click="wuliaooption(1)"  type="button" class="btn btn-default  xbd"><span class="glyphicon glyphicon-plus-sign"></span>选择物料</button>
        <button @click="createsup()"  type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus-sign"></span>生成物料</button>
    </div>
    <%--BOMdiv--%>
    <div style="width: 1325px;height: 500px;border-top: 1px solid black;display: none" id="bomdiv">
        <div style="width: 1255px;height: 500px; overflow: auto">
            <table class="bomtable table">
                <tr class="bomtest">
                    <td>配色</td>
                    <td>尺码</td>
                    <td>供应商</td>
                    <td>物料名称</td>
                    <td>规格型号</td>
                    <td>颜色</td>
                    <td>单位</td>
                    <td>价格</td>
                    <td>数量</td>
                    <td>操作</td>
                </tr>
                <tbody id="bomcontent">
               <%-- <tr v-for="clothArr in clothArr" class="bomtest">
                    <td>{{clothArr.clothname}}</td>
                    <td></td>
                    <td>{{clothArr.clothrmark}}</td>
                </tr>--%>
                </tbody>
            </table>
        </div>
    </div>

<%--生成物料DIV--%>
    <%--生成物料DIV导航栏--%>
    <div style="width: 1325px;height: 40px;display: none" id="lydiv">
        <button @click="subclick()" type="button" class="btn btn-default"><span class="glyphicon glyphicon-ok-sign"></span>提交</button>
    </div>
    <%--BOMdiv--%>
    <div style="width: 1325px;height: 500px;border-top: 1px solid black;display: none" id="supdiv">
        <div style="width: 1255px;height: 500px; overflow: auto">
            <table class="bomtable table">
                <tr class="bomtest">
                    <td>供应商</td>
                    <td>物料名称</td>
                    <td>规格型号</td>
                    <td>颜色</td>
                    <td>单位</td>
                    <td>单价</td>
                    <td>总价</td>
                    <td>合计数量</td>
                </tr>
                <tbody id="supcontent">

                </tbody>
            </table>
        </div>
    </div>



</div>


</div>
<%--data-toggle="modal" data-target="#myModal"--%>


<!-- 尺寸模态框（Modal） -->
<div class="modal fade" style="background-color:rgba(0,0,0,0);"  id="samodel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="background: #F1F2F2;font-family: 楷体;">
        <div class="modal-content" style="background: #F1F2F2;font-family: 楷体;" id="SizeModels">
            <div class="modal-body" style="background: #F1F2F2;font-family: 楷体;" >

                <table style="background:black;font-family: 楷体;">
                    <tr id="onecolor">
                        <td class="chimache"><input type="checkbox" name="ssss" onclick="selecteAlldd(this)"  id="selecteAll" class="seall"></td>
                        <td class="chimaxe" style="text-align: center;background:#BEE9F0">尺码</td>
                    </tr>
                    <tr v-for="allsize in allsize" class="hocolors">
                        <div style="width: 470px;" class="divaaa">
                        <td class="chimache"><input type="checkbox"  class="qqqq" onclick="xuanze(this.checked)" name="sizename" :value="allsize.sizeid"></td>
                            <td class="chimaxe"><span>{{allsize.sizename}}</span></td>
                        </div>
                    </tr>
                </table>
            </div>

            <div class="modal-footer" style="background: #D6D7DC;">
                <button type="button" class="btn btn-default" data-dismiss="modal" @click="affchima()">确认
                </button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
            </div>

        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<%--颜色模态框--%>
<div class="modal fade" style="background-color:rgba(0,0,0,0);"  id="colormodel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="background: #EDF4FF;font-family: 楷体;width: 800px;height:450px;margin-left: 200px;">
        <div class="modal-content" style="background: #EDF4FF;font-family: 楷体;" id="what">
            <div class="modal-body" style="background: #EDF4FF;font-family: 楷体; width: 800px;height:450px;" >
            <div id="colorttype">
                <div style="height:420px;overflow:auto;width:150px;border: 2px solid #95B8E7;float: left" id="colorttypetable" >
                    <div style="height:auto;width:100px;">
                       <%-- <table >
                            <tr  v-for="colorTypes in colorTypes">
                                <td>{{colorTypes.tintypename}}</td>
                            </tr>
                        </table>--%>
                        <span   style="margin-left: 5px;"><a  ondblclick="copyval(this)" class="glyphicon glyphicon-folder-open">所有类别</a></span><br/>
                           <div    style="width: 145px;height:20px;padding-top: 5px;border:0px solid red;padding-left:30px;font-size: 12px;" v-for="colorTypes in colorTypes"> <a ondblclick="copyval(this)" class="glyphicon glyphicon-list-alt">{{colorTypes.tintypename}}</a></div>
                    </div>
                </div>
                <div id="colorlibrary" style="height:420px;width:600px;border: 2px solid #95B8E7;float: left">
                    <div class="input-group input-group-lg">
                        <p></p>
                        <label  class="col-sm-2 control-label" style="text-align: center;line-height:25px;width:60px;height: 25px;font-size: 14px;">颜色</label>  <input type="text" ref="testval" class="form-control" style="width: 190px;height: 25px;font-size:15px;color:#999999"  placeholder="请输入颜色名称">
                        <label  class="col-sm-2 control-label" style="text-align: center;line-height:25px;width:60px;height: 25px;font-size: 14px;">类别</label>  <input class="form-control" style="float: left;margin-left:20px;width: 100px;height: 25px;font-size:15px;color:#999999" readonly value="所有类别" ref="typeval">
                        <button onclick="likeselecolor()" class="btn btn-info" style="text-align: center;line-height:10px;float: left;margin-left:20px;width: 80px;height: 25px;font-size:15px;">查询</button>
                        <br/><p>  </p>
                    </div>
                    <table class="table" style="text-align: center">
                        <tr style="background-color: #e8e8e8;border-bottom:3px solid #afbdc9">
                            <td style="background-color: #e8e8e8">颜色</td>
                            <td style="background-color: #e8e8e8">色值</td>
                            <td style="background-color: #e8e8e8">类别</td>
                            <td style="background-color: #e8e8e8">操作</td>
                        </tr>
                        <tr v-for="colorLibrary in colorLibrary">
                            <td style="display: none">{{colorLibrary.tinctid}}</td>
                            <td>{{colorLibrary.tinctname}}</td>
                            <td>{{colorLibrary.tinctzhi}}</td>
                            <td>{{colorLibrary.tintypename}}</td>
                            <td><button class="btn btn-default" data-dismiss="modal" onclick="submitcolor(this)">确定</button></td>
                        </tr>
                    </table>
                    <div id="fanye">
                        <ul class="pagination  pagination-lg fenye">
                            <li><a @click="shang.shang(1)">上一页</a></li>
                            <li><a>{{colortype.CurrPage}}/{{colortype.MaxPage}}</a></li>
                            <li><a  @click="shang.xia(1)">下一页</a></li>
                            <li><a><input  v-model="colortype.zzz" style="width:70px;height: 20px; font-size: 15px;" ref="vals"
                                           onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"/>/{{colortype.MaxPage}}</a></li>
                            <li><a  @click="shang.fan(1)">跳转</a></li>
                        </ul>
                    </div>
                </div>
                <%--<table id="colorttypetable" style="height:50px;overflow:hidden;width:100px;">
                    <tr v-for="colorTypes in colorTypes" >
                        <td>{{colorTypes.tintypename}}</td>
                    </tr>
                </table>--%>
            </div>
            </div>
            <div class="modal-footer" style="background: #D6D7DC;width: 800px;">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
            </div>

        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>


<!-- BOM模态框（Modal） -->
<div class="modal fade" style="background-color:rgba(0,0,0,0);margin-left: -400px;margin-top: -20px;"  id="Bommodel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="background: #F1F2F2;font-family: 楷体;">
        <div class="modal-content" style="background: #F1F2F2;font-family: 楷体;" id="BOMModels">
            <div class="modal-body" style="background: #EDF4FF;font-family: 楷体; width: 1000px;height:530px;" >
                <%--<div id="colorttype">
                    <div style="height:420px;overflow:auto;width:150px;border: 2px solid #95B8E7;float: left" id="colorttypetable" >
                        <div style="height:auto;width:100px;">
                            &lt;%&ndash; <table >
                                 <tr  v-for="colorTypes in colorTypes">
                                     <td>{{colorTypes.tintypename}}</td>
                                 </tr>
                             </table>&ndash;%&gt;
                            <span   style="margin-left: 5px;"><a  ondblclick="copyval(this)" class="glyphicon glyphicon-folder-open">所有类别</a></span><br/>
                            <div    style="width: 145px;height:20px;padding-top: 5px;border:0px solid red;padding-left:30px;font-size: 12px;" v-for="colorTypes in colorTypes"> <a ondblclick="copyval(this)" class="glyphicon glyphicon-list-alt">{{colorTypes.tintypename}}</a></div>
                        </div>
                    </div>--%>
                    <div id="wuliaolibrary" style="height:270px;width:975px;border: 2px solid #95B8E7;">
                        <div class="input-group input-group-lg">
                            <p></p>
                            <label  class="col-sm-2 control-label" style="text-align: center;line-height:25px;width:100px;height: 25px;font-size: 15px;">供应商</label>  <input ref="bomgys" class="form-control" style="width: 150px;height: 25px;font-size:15px;color:#999999"  placeholder="供应商名称">
                            <label  class="col-sm-2 control-label" style="text-align: center;line-height:25px;width:100px;height: 25px;font-size: 15px;">物料名称</label>  <input ref="bomwlname" class="form-control" style="float: left;margin-left:10px;width: 150px;height: 25px;font-size:15px;color:#999999" placeholder="物料名称" <%--ref="typeval"--%>>
                            <label  class="col-sm-2 control-label" style="text-align: center;line-height:25px;width:100px;height: 25px;font-size: 15px;">颜色</label>  <input  ref="bomcolor"class="form-control" style="float: left;margin-left:10px;width: 150px;height: 25px;font-size:15px;color:#999999" placeholder="物料颜色">
                            <button @click="selebut(1)" class="btn btn-info" style="text-align: center;line-height:10px;float: left;margin-left:20px;width: 80px;height: 25px;font-size:15px;">查询</button>
                            <br/><p>  </p>
                        </div>
                        <table class="table-condensed class" style="text-align: center;" id="bomtabone" >
                            <tr style="background-color: #e8e8e8;border-bottom:3px solid #afbdc9;height:15px;">
                                <td style="background-color: #e8e8e8;">供应商</td>
                                <td style="background-color: #e8e8e8;">物料名称</td>
                                <td style="background-color: #e8e8e8;">规格型号</td>
                                <td style="background-color: #e8e8e8;">颜色</td>
                                <td style="background-color: #e8e8e8;">单位</td>
                                <td style="background-color: #e8e8e8;">价格</td>
                                <td style="background-color: #e8e8e8;">操作</td>
                            </tr>
                            <tr v-for="supplies in suppliesList" class="bomapptr">
                                <td  style="display: none">{{supplies.sdinfoid}}</td>
                                <td>{{supplies.supname}}</td>
                                <td>{{supplies.sdinfoname}}</td>
                                <td>{{supplies.supmodels}}</td>
                                <td>{{supplies.sdcolor}}</td>
                                <td>{{supplies.sdinfounit}}</td>
                                <td>{{supplies.sdinfobuy}}</td>
                                <td><button class="btn btn-default btn-sm" onclick="shiftTr(this)">确定</button></td>
                            </tr>
                        </table>
                        <div id="bomfanye" style="border: 0px solid black;">
                            <ul class="pagination pagination-sm bomfenye">
                                <li style="width:50px;height:15px;"><a @click="shang(1)">上一页</a></li>
                                <li><a>{{CurrPage}}/{{MaxPage}}</a></li>
                                <li><a  @click="xia(1)">下一页</a></li>
                                <li><a><input  v-model="currba"  style="width:70px;height: 20px; font-size: 15px;" ref="bomvals"
                                               onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"/>/{{MaxPage}}</a></li>
                                <li><a  @click="fan(1)">跳转</a></li>
                            </ul>
                        </div>
                    </div>
                    <%--全部在这个地方显示所选的物料--%>
                    <div style="height:240px;width:975px;border: 2px solid #95B8E7;overflow: auto">
                        <table class="table-condensed class" style="text-align: center;" id="bomtabtwo" >
                            <tr style="background-color: #e8e8e8;border-bottom:3px solid #afbdc9;height:15px;">
                                <td style="background-color: #e8e8e8;">供应商</td>
                                <td style="background-color: #e8e8e8;">物料名称</td>
                                <td style="background-color: #e8e8e8;">规格型号</td>
                                <td style="background-color: #e8e8e8;">颜色</td>
                                <td style="background-color: #e8e8e8;">单位</td>
                                <td style="background-color: #e8e8e8;">价格</td>
                                <td style="background-color: #e8e8e8;">操作</td>
                            </tr>
                            <tbody id="bomtbody">

                            </tbody>
                        </table>
                    </div>

                </div>
            <div style="background: #EDF4FF;font-family: 楷体; width: 1000px;height:30px;">
                <button   style="margin-left:380px;width: 100px;height:25px;"  class="btn btn-success btn-sm" data-dismiss="modal" onclick="addbomcon()">确定
                </button>

                <button style="margin-right:160px;width: 100px;height:25px;" type="button" class="btn btn-warning btn-sm" data-dismiss="modal">关闭
                </button>
            </div>
            </div>




        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

</body>
</html>

<script>

                               /*************/
    $(function(){

        load.load();
    });



    Vue.use(VueResource);
    var load=new Vue({
        el:"#seleAll",
        data:{
            /*客户*/
            clientss:'',
            /*所有季度*/
            seasonss:'',
            /*所有样板类型*/
            platess:'',
            /*所有品牌*/
            brandss:'',
            /*所有款号*/
            stylehaoss:'',
            /*根据款号查款式*/
            designss:'',

            /*开发单号*/
            uuid:'',
            //根据所选尺码得到的信息
            chimaxx:'',
            a:1,

            //款式的服装部位
            clothArr:'',
            //chval:new Map(),
            //客户id
            clid:'',
            //品牌ID
            brandid:'',
            //季度ID
            seaid:'',
            //版型ID
            plaid:'',
            //款号
            haoid:'',
            //款式id
            designid:'',






        },
        methods:{
/*页面加载所有相关基本信息*/
            load:function(){
                var url="/consele/seleAll"
                this.$http.post(url).then(
                    function (data) {
                        this.clientss= data.body.clientss;
                        this.seasonss= data.body.seasonss;
                        this.platess= data.body.platess;
                        this.brandss=data.body.brandss;
                        this.stylehaoss=data.body.stylehaoss;
                        this.uuid=data.body.uuid;
                    },
                    function(){})
            },
            test:function(){
                //alert(this.$refs.clid.value);
            },
            /*根据款号得到所有款式*/
            seleks:function () {
                //alert(this.$refs.haoid.value)
                var url="/consele/seledesign/"+this.$refs.haoid.value;
                this.$http.post(url).then(
                    function(data){
                        this.designss=data.body;
                    }
                )
            },
            //查询所有尺码
            seleAllSize:function(){
                var url="/consele/seleAllsize";
                this.$http.post(url).then(
                    function(data){
                        //查询出的所有尺码放到sizeModel作用域下
                        sizeModel.allsize=data.body;
                    }
                )
            },
            //增行
            addLine:function(){

               /*alert(chval.size);
               for (var sim in chval){
                   alert(map[sim]);
               }*/
               /*for (var i=0;i<chval.size;i++){
                   alert(chval[i]);
               }*/
                if (chval.size<1){
                    alert("尺码不能为空");
                }else{
                    //标题的个数
                 var les=parseInt($(".xmbtest th").length)-5;
                    //alert(sizeModel.chval);
                    //var sjson=JSON.stringify(sizeModel.chval);
                   // alert(sizeModel.chval);
                  /* var url="/consele/seleSize/"+sizeModel.chval;
                    this.$http.post(url, {'chval':sizeModel.chval},{arrayFormat:'brackets'}).then(function (data) {
                        //testxmbbody.chimaxx=data.body;
                        //alert(data.body);
                        var dd=data.body;*/
                        var tr="<tr>";
                        tr+="<td style='display: none'><input style='display: none' class='yanseid"+load.a+"'  readonly/></td>";
                        tr+="<td><input name='yansename' class='yansename"+load.a+"' onclick='testxmbbody.dianji("+load.a+")'   data-toggle='modal' data-target='#colormodel' readonly/></td>";
                        tr+="<td><input readonly class='yanseval"+load.a+"'/></td>";
                       /* tr+="<td><select><option>--请选择尺码--</option>";*/

                        //tr+="<option  v-for='chval in chval' :value='chval.sizeid'>'{{chval.sizename}}'</option>";
                    /*chval.forEach(function(value,key){
                       tr+="<option value="+key+">"+value+"</option>";
                });*/

                        //tr+="<option v-for='va in chval' :value='$key'>"+"+{{+"+value+"}}+"</option>";
                   /* for (var sp=0;sp<chval.length;sp++){
                            tr+="<option value="+dd[sp].sizeid+">"+dd[sp].sizename+"</option>";
                        }*/
                        //tr+="</select></td>";
                   /* chval.forEach(function(value,key){

                    })*/
                        for (var i=0;i<les;i++){

                            tr+="<td><span></span><input class='chimadaxiao"+load.a+"' onblur='heji("+load.a+",this)' value='0' onafterpaste=\"this.value=this.value.replace(/[^0-9]/g,'')\"  onkeyup=\"this.value=this.value.replace(/[^0-9]/g,'')\"/></td>";
                        }

                    tr+="<td><input class='heji"+ load.a+"' readonly value='0'/></td>";

                        tr+="<td style='width:100px;height:30px;'><button  onclick='deletr(this)' class='btn btn-default' style='height:27px;font-size:16px;padding-top:2px;text-align: center;line-height: 10px;'><span class=' glyphicon glyphicon-minus-sign'></span>删除</button></td>";
                        tr+="</tr>";
                        $("#xmbbody").append(tr);
                        $("#xmbbody input").width(100);
                        load.a++;
                        //alert(testxmbbody.chimaxx);
                    /*})*/
                }
            },
            //尺寸导航
            chicunclick:function() {
                if (load.$refs.designid.value != 0) {
                    //尺码显示
                    $("#chicundaohang").show();
                    $("#chicundiv").show();
                    //细码隐藏
                    $("#ximadaohang").hide();
                    $("#ximadiv").hide();
                    //BOM隐藏
                    $("#bomdaohang").hide();
                    $("#bomdiv").hide();
                    //用料隐藏
                    $("#lydiv").hide();
                    $("#supdiv").hide();

                    //alert(load.$refs.designid.value);
                    this.$http.post("/consele/selecloth/"+load.$refs.designid.value).then(function(data){
                       load.clothArr=data.body;
                        },
                        function () {

                    })
                } else {
                    alert("款式不能为空");
                }
            },
            //细码导航
            ximaclick:function(){
                //细码显示
                $("#ximadaohang").show();
                $("#ximadiv").show();
                //尺码隐藏
                $("#chicundaohang").hide();
                $("#chicundiv").hide();
                //BOM隐藏
                $("#bomdaohang").hide();
                $("#bomdiv").hide();

                //用料隐藏
                $("#lydiv").hide();
                $("#supdiv").hide();

            },
            bomclick:function(){
                //细码显示
                $("#ximadaohang").hide();
                $("#ximadiv").hide();
                //尺码隐藏
                $("#chicundaohang").hide();
                $("#chicundiv").hide();
                //BOM隐藏
                $("#bomdaohang").show();
                $("#bomdiv").show();
                //用料隐藏
                $("#lydiv").hide();
                $("#supdiv").hide();
            },
            //查询物料
            wuliaooption:function(pageNum){
                if ($("#xmbbody").html()==null||$("#xmbbody").html()==''){
                    alert("尺码不能等于空");
                }else {

                    var cpap;
                    $("#xmbbody tr").each(function(){

                        if ($(this).children("td:eq(1)").find("input").val()==null||$(this).children("td:eq(1)").find("input").val()==''||$(this).children("td:eq(-2)").find("input").val()==0){
                            cpap=false;
                            return false;
                        }

                    });

                    if (cpap==false){
                        alert("颜色和数量不能为空");

                    }else {
                        $("#bomtbody").html('');
                            //data-toggle="modal" data-target="#Bommodel"
                            $(".xbd").attr("data-toggle",'modal');
                            $(".xbd").attr("data-target",'#Bommodel');

                if(pageNum==null){
                    pageNum=1;
                }
                /*bomgys=Bommodel.$refs.bomgys.value;
                bomwlname=Bommodel.$refs.bomwlname.value;
                bomcolor=Bommodel.$refs.bomcolor.value;*/
                this.$http.post("/consele/selesuppliesdeta",{PageNum:pageNum,
                    bomgys:Bommodel.$refs.bomgys.value,
                    bomwlname:Bommodel.$refs.bomwlname.value,
                    bomcolor:Bommodel.$refs.bomcolor.value},{emulateJSON: true}).then(function(data){

                    Bommodel.suppliesList=data.body.list;
                    Bommodel.CurrPage=data.body.pageNum;
                    Bommodel.MaxPage=data.body.pages;
                    Bommodel.currba=data.body.pageNum;
                })

                            //判断尾部
                    }
                };

            },
            //生成物料
            createsup:function(){
                if ($("#bomcontent").html()==null||$("#bomcontent").html()==''){
                    alert("物料不能为空");

                }else{
                    //判断数量不能为空
                    var padu;
                    $(".wuliaosum").each(function(){
                        if ($(this).val()==''||$(this).val()==null){

                            padu = false;
                            return false;
                        }
                    });
                   if (padu==false){
                       alert('数量不能为空')
                   }else{




                //生成物料DIV显示
                $("#supdiv").show();
                $("#lydiv").show();

                //细码隐藏
                $("#ximadaohang").hide();
                $("#ximadiv").hide();
                //尺码隐藏
                $("#chicundaohang").hide();
                $("#chicundiv").hide();
                //BOM隐藏
                $("#bomdaohang").hide();
                $("#bomdiv").hide();

                $("#supcontent").html("");
              //循环tr
              $("#bomcontent tr").each(function(){

                  var supinfo="<tr>";
                  for (var i=2;i<9;i++){
                      var supggg=$(this).children("td:eq("+i+")").html();
                      if (i==2){
                          supinfo+="<td style='display:none'>"+supggg+"</td>";
                      }else{
                          supinfo+="<td>"+supggg+"</td>";
                      }

                  }


                  /*
                  * 四种情况 ALL-ALL  ALL-ONE   ONE-ALL one-one
                  * */

                  //每一个物料的所需总数
                  var sum=0;
                  //每个衣服要的材料数量
                  var supnum=$(this).children("td:eq(-2)").find("input").val();

                  //一共几个颜色option
                  var selength=$(this).children("td:eq(0)").find("option").length;
                  //当前选中的配色是第几个
                  var seindex=$(this).children("td:eq(0)").children("select").get(0).selectedIndex;
                 //一共几个尺码option
                  var cmlength=$(this).children("td:eq(1)").find("option").length;
                  //当前选中的尺码是第几个
                 var cmindex=$(this).children("td:eq(1)").children("select").get(0).selectedIndex;

                  //当他们的颜色select等于ALL时  option 1=ALL
                  //当颜色当与ALL时判断
                  //all-all all-one
               if (seindex==0){

                   //ALL-ALL
                   if (cmindex==0){
                       $("#xmbbody tr").each(function(){
                           //得到合计
                           sum+=supnum*$(this).children("td:eq(-2)").find("input").val();
                       })
                   };
                   //ALL-one
                   if (cmindex!=0){
                       $("#xmbbody tr").each(function(){
                           //尺码的当前位置
                           var colind= 3+parseInt(cmindex);
                          // alert("colind:"+colind);
                           var coloval=$(this).children("td:eq("+colind+")").find("input").val();
                          sum+=supnum*coloval;
                       })
                   };
               };
               //当颜色不=All时判断
               if(seindex!=0){
                   //alert(seindex);
                   var sp=parseInt(seindex-1);
                   //单尺码等于ALL时
                   //one-ALL  当尺码=all时得到他的合计
                   if(cmindex==0){
                       //合计的值
                       var wlsum=$("#xmbbody").find("tr:eq("+sp+")").find("td:eq(-2)").find("input").val();
                       sum+=supnum*wlsum;
                   };
                   //one-one
                   if (cmindex!=0){
                       //尺码的当前位置
                       var colind= 3+parseInt(cmindex);
                       var wlsum=$("#xmbbody").find("tr:eq("+sp+")").find("td:eq("+colind+")").find("input").val();
                       sum+=supnum*wlsum;
                   } ;
               };
               //单价
                  var danjia=$(this).children("td:eq(8)").html();
                  //总价
                  supinfo+="<td>"+parseFloat(danjia*sum).toFixed(2)+"</td>";
                  //总数
                  supinfo+="<td>"+sum+"</td>";
                  supinfo+="</tr>"
                  $("#supcontent").append(supinfo);
              });


                   };
                }
                /* $("#xmbbody tr").each(function(){
                     alert($(this).html());
                 })*/
              //alert($("#bomcontent tr td select option").length);

            },
            //用料隐藏显示
            ylclick:function(){
                //生成物料DIV显示
                $("#supdiv").show();
                $("#lydiv").show();

                //细码隐藏
                $("#ximadaohang").hide();
                $("#ximadiv").hide();
                //尺码隐藏
                $("#chicundaohang").hide();
                $("#chicundiv").hide();
                //BOM隐藏
                $("#bomdaohang").hide();
                $("#bomdiv").hide();
            },
            //提交
            subclick:function(){


                //订单&&明细
                //客户的id  不能等于0   订单
                clid=parseInt(this.$refs.clid.value);
                //品牌id 不能等于0      订单
                brandid=parseInt(this.$refs.brandid.value);
                //季度ID 不能等于0     订单
                seaid=parseInt(this.$refs.seaid.value);
               //版型ID 不能等于0      订单
                plaid =parseInt(this.$refs.plaid.value);
                //接单日期            订单
                jiedanriqi=$("#tt1").val();
                //版期              订单
                banqi=$("#tt2").val();
                //状态 不能等于0       订单明细
                ordstatus= $("#ordstatus").val();
                //开发单号             订单
                orduuid= $("#tt3").val();
                //样板倍数              订单明细
                tempmulr=parseFloat($("#tt4").val()).toFixed(2);
                //款号ID  不能等于0     订单
                haoid =parseInt(this.$refs.haoid.value);
                //款式id  不能等于0     订单
                designid =parseInt(this.$refs.designid.value);
                //跟单人             订单
                docuper= $("#tt5").val();
                //生产厂家(不是必须添加)   明细
                chuangjia= $("#tt6").val();
                //备注(不是必须添加)  明细
                remarks= $("#tt7").val();

                if (clid!=0&&brandid!=0&&seaid!=0&&plaid!=0&&(jiedanriqi!=null&&jiedanriqi!='')&&(banqi!=null&&banqi!='')
                &&ordstatus!=0&&(tempmulr!=''&&tempmulr!=null)&&haoid!=0&&designid!=0){

                    if ($("#supcontent").html()=='') {
                        alert("物料为空，不能生成");
                    }else{


                //细码数组
                var ximaData=new Array();
                //总共的件数
                var ybSum=0;
                //细码表
                //尺码的长度
               chsize= chval.size;
                $("#xmbbody tr").each(function(){
                    //颜色id        细码表
                    colorid=$(this).children("td:eq(0)").find("input").val();
                    for (var i=3;i<chsize+3;i++){

                        //尺码的数量   细码表
                        chimasum=$(this).children("td:eq("+i+")").find("input").val();
                        ybSum+=parseInt(chimasum);
                        //尺码的ID   细码表
                        chimaid=$(".xmbtest").children("th:eq("+i+")").find("input").val();
                        if (chimasum>0){
                            //有数量值就添加
                            var ss={};ss['colorid']=colorid;ss['chimaid']=chimaid;ss['chimasum']=chimasum;
                            //ximaData.push('{"colorid":'+colorid+',"chimaid":'+chimaid+',"chimasum":'+chimasum+'}')
                            ximaData.push(ss);
                        }else{
                            //没有记忆不添加
                        }
                    }

                });

                //定义用料的数组
                var supData=new Array();
                //用料表
                $("#supcontent tr").each(function(){
                    //物料外键
                    supid=$(this).children("td:eq(0)").html();
                    //合计数量
                    supsum=$(this).children("td:eq(-1)").html()
                    //总价
                     monsum=$(this).children("td:eq(-2)").html()
                    var ss={};ss['supid']=supid;ss['supsum']=supsum;ss['monsum']=monsum;
                    supData.push(ss);
                })

                //明细数组
                //var ordinfoData=new Array();
                var intest={};
                intest['ordstatus']=ordstatus;
                intest['tempmulr']=tempmulr;
                intest['chuangjia']=chuangjia;
                intest['remarks']=remarks;

                //订单数组
               // var ordData =new Array();
                var ordtest={};
                ordtest['clid']=clid;ordtest['brandid']=brandid;ordtest['seaid']=seaid;
                ordtest['plaid']=plaid;ordtest['jiedanriqi']=jiedanriqi;ordtest['banqi']=banqi;
                ordtest['orduuid']=orduuid;ordtest['haoid']=haoid;ordtest['designid']=designid;
                ordtest['docuper']=docuper; ordtest['supSum']=ybSum;

                var JSONval = {};
                JSONval["orderUtil"] = ordtest;
                JSONval["orderInfoUtil"] = intest;
                //alert(JSON.stringify(supData));
                //alert(JSON.stringify(ximaData));
                subjax(ordtest,intest,supData,ximaData);
                        //判断尾部
                    }
                }else{
                    alert("信息不完整");
                };

            },
        }
    });


function subjax(ord,oin,a,b) {
    $.ajax({
        url:'/consele/subsup',
        type:'POST',
       // data:{supUtil:a,chicaUtil:b},
        //这个写法
        data:JSON.stringify({"orderInfoUtil":oin,"orderUtil":ord,"supUtil":a,"chicaUtil":b}),
        //不叫深度解析
        traditional:true,
        dataType : "json",
        contentType : 'application/json;charset=UTF-8',
        success:function(data)
        {
            alert("订单生成成功");
            window.location.href='/jsp/openup.jsp';
        }
    })
}

    function heji(obj,op) {
       // alert($(op).val());
        if ($(op).val()==''){
            $(op).val(0);
        }
        var a=0;
        var foo= $("input[class='chimadaxiao"+obj+"']");
        $(foo).each(function() {
          a+=parseInt($(this).val());
        })
        $(".heji"+obj).val(a);
      /*  $(".chimadaxaiao"+obj).each(function(){
            alert($(this).val());
            a+=($(this).val());
        })*/
       // alert(a);
       /// alert($(".chimadaxaiao"+obj).val());
      /*  alert($(obj).parents("tr td .chimadaxiao").val());
        $(obj).parents("tr >td> .chimadaxiao").each(function(){
            alert($(this).val());
           /!* var tdarr=$(this).children();
            alert(tdarr.find(".chimadaxiao").val());*!/
        })*/
    }
    

//删行
  function deletr(obj) {
      $(obj).parent().parent().remove();
  }






    //选中框的值
    var chval=new Map();
//所有尺码
    var sizeModel=new Vue({
        el:'#SizeModels',

        data:{
            /*所有尺码*/
            allsize:'',
            //全选框
            xuanxuan:'',
            //mapa:'',
        },
        methods:{
            affchima:function () {
                $(".xmbtest").html("");

                //清空数组
                 this.chval =[];
                 var xmbtd="<th style='display:none'>没用</th><th>颜色名称</th><th>色值</th>";

                $(".qqqq").each(function(){
                    if (this.checked){
                        //chimache
                        var v=this.value;
                        var ht=$(this).parent().next().children("span").text();
                        //load.chval+={v:ht};
                        //alert(load.chval);
                        //alert();
                        chval.set(v,ht)
                        xmbtd+="<th><input value='"+v+"' style='display:none'/> "+ht+"</th>";
                        //xmtzhuijia

                       //load.chval(sizeModel.mapa(v,ht));
                    }
                }) //1325px
                xmbtd+="<th>合计</th>";
                xmbtd+="<th>操作</th>";
                $(".xmbtest").append(xmbtd);
                //这样会变得整齐
                $(".xmbtest th").width(100);

            }

        },


    });
//copy类别
    function copyval(ap) {

        colortype.$refs.typeval.value=$(ap).parent().text()
       // $("#typeval").value($(ap).parent().text());
        //alert($("#typeval").value());

    }
    //点击查询
    function   likeselecolor(){
        testxmbbody.colorpage(1,colortype.$refs.typeval.value,colortype.$refs.testval.value);
        //alert(colortype.$refs.testval.value);
        //alert(colortype.$refs.typeval.value);
    }
    //颜色
    var colortype=new Vue({
        el:'#what',
        data:{
            //颜色类别
            colorTypes:'',
            //颜色库
            colorLibrary:'',
            CurrPage:'',//当前页CurrPage
            MaxPage:'',//最大页数
            vals:'',
            zzz:'',
            typeval:'',
            testval:'',
            //获取他的行数 废弃
            colorindex:'',
        },method:{
            //这个失效莫名其妙 已解决
           /* likeselecolor:function(){
                alert(1);
            }*/
        }
    });

    //颜色相关
    var testxmbbody=new Vue({
        el:'#xmbbody',
        data:{
            chimaxx:'',
        },
        methods:{
            //查询颜色类别
            dianji:function (a){


                //行数给他
                shang.tabdex=a;
                //查询颜色类别 有测试一边
                this.$http.post("/consele/seleTincttype").then(function(data){
                    colortype.colorTypes=data.body;
                    this.colorpage();
                },function(){

                })
            },
            //查询颜色库所有颜色
            colorpage:function (pagenum,typecolor,colorname) {

                if (pagenum==null){
                    pagenum=1;
                }
                if (typecolor==null){
                    typecolor='所有类别';
                }
                if (colorname==null){
                    colorname='';
                }
                //查询颜色库所有颜色
                this.$http.post("/consele/seleseleTinct",{PageNum:pagenum,typecolor:typecolor,colorname:colorname},{emulateJSON: true}).then(function (data) {
                    colortype.CurrPage= data.body.pageNum;
                    colortype.zzz= data.body.pageNum;
                    colortype.MaxPage=data.body.pages;
                    colortype.colorLibrary=data.body.list;
                },function(){})
            },

        }
    });
    //叫颜色传到input框中

    function submitcolor(op) {

       // alert();
        //prev上一个兄弟节点
       var colorid=$(op).parent().prev().prev().prev().prev().text(); //颜色id
        var colorname=$(op).parent().prev().prev().prev().text();//颜色name
        var colorval=$(op).parent().prev().prev().text();//颜色色值
       // alert(shang.tabdex);
       // alert($(".yansename"+shang.tabdex+"").value());
        //alert(shang.tabdex);
        //id
        //alert($(".yanseid"+shang.tabdex+"").val());
        $(".yanseid"+shang.tabdex+"").val(colorid);
        //name
        $(".yansename"+shang.tabdex+"").val(colorname);
        //色值
        $(".yanseval"+shang.tabdex+"").val(colorval);
        //alert($(".yanseid"+shang.tabdex+"").value);

    }


//颜色分页
    var shang=new Vue({
        el:'#fanye',
        data:{

            MaxPage:"",//最大页数
            vals:"",
            zzz:"",
            //tableindex
            tabdex:'',
        },
        methods:{
            fan:function(PageNum){
                if (colortype.$refs.vals.value==null){
                    colortype.$refs.vals.value=colortype.CurrPage;
                }
                if (colortype.$refs.vals.value==""){
                    colortype.$refs.vals.value=colortype.CurrPage;
                }
                if(colortype.$refs.vals.value>colortype.MaxPage){
                    colortype.$refs.vals.value=colortype.MaxPage;
                }
                testxmbbody.colorpage(PageNum,colortype.$refs.typeval.value,colortype.$refs.testval.value);
                //alert(this.$refs.vals.value);
                //load.fenye(this.$refs.vals.value,showhide.$refs.testval.value);


            },shang:function(PageNum){
                if (colortype.CurrPage-PageNum==0){
                    PageNum=1;

                }else{
                    PageNum=colortype.CurrPage-PageNum;
                }
                testxmbbody.colorpage(PageNum,colortype.$refs.typeval.value,colortype.$refs.testval.value);
               // load.fenye(PageNum, showhide.$refs.testval.value);

            },xia:function(PageNum){
                if (colortype.CurrPage+PageNum>colortype.MaxPage){
                    PageNum=colortype.CurrPage;
                }else{
                    PageNum=colortype.CurrPage+PageNum;
                }
                testxmbbody.colorpage(PageNum,colortype.$refs.typeval.value,colortype.$refs.testval.value);
                // showhide.$refs.testval.value
                //load.fenye(PageNum,showhide.$refs.testval.value);

            }
        }
    })



//Bom分页
       //Bom模态窗口中的数据
       var Bommodel=new Vue({
           el:'#Bommodel',
           data:{
               //物料信息
               suppliesList:'',
               CurrPage:'',
               MaxPage:'',
               //跳转值
               bomvals:'',
               //供应商name
               bomgys:'',
               //物料name
               bomwlname:'',
               //colorname
               bomcolor:'',
               //跳转里面的数据值
               currba:'',

           },
        methods:{
        fan:function(PageNum){

           if (Bommodel.$refs.bomvals.value==null){
               Bommodel.$refs.bomvals.value=Bommodel.CurrPage;
           }
           if (Bommodel.$refs.bomvals.value==""){
               Bommodel.$refs.bomvals.value=Bommodel.CurrPage;
           }
           if(Bommodel.$refs.bomvals.value>Bommodel.MaxPage){
               Bommodel.$refs.bomvals.value=Bommodel.MaxPage;
           }
           load.wuliaooption(Bommodel.$refs.bomvals.value);
           //testxmbbody.colorpage(PageNum,BomTest.$refs.typeval.value,BomTest.$refs.testval.value);
           //alert(this.$refs.vals.value);
           //load.fenye(this.$refs.vals.value,showhide.$refs.testval.value);


        },shang:function(PageNum){

           if (Bommodel.CurrPage-PageNum==0){
               PageNum=1;

           }else{
               PageNum=Bommodel.CurrPage-PageNum;
           }
                load.wuliaooption(PageNum);
           //testxmbbody.colorpage(PageNum,colortype.$refs.typeval.value,colortype.$refs.testval.value);
           // load.fenye(PageNum, showhide.$refs.testval.value);

        },xia:function(PageNum){
           if (Bommodel.CurrPage+PageNum>Bommodel.MaxPage){
               PageNum=Bommodel.CurrPage;
           }else{
               PageNum=Bommodel.CurrPage+PageNum;
           }
                load.wuliaooption(PageNum);
           //testxmbbody.colorpage(PageNum,colortype.$refs.typeval.value,colortype.$refs.testval.value);
           // showhide.$refs.testval.value
           //load.fenye(PageNum,showhide.$refs.testval.value);

        },
            selebut:function(PageNum){

                load.wuliaooption(PageNum);
            },

         /*   shiftTr:function(a){

            //获取按钮所在行
               var bomhtml=$(a).parents("tr").html;
               alert(bomhtml);
            },*/
          /*  addbomcon:function(){
                alert(1);
            },*/




        }
        })

//物料确定添加到所选物料
    function shiftTr(a) {
        //获取所选物料添加到已选上
        var trs="<tr>";
        for (var i=0;i<7;i++){
            if (i==0){
                trs+="<td style='display:none'>"+$(a).parents("tr").find("td:eq("+i+")").html()+"</td>";
            }else{
                trs+="<td>"+$(a).parents("tr").find("td:eq("+i+")").html()+"</td>";
            }

            }
        trs+="<td><button onclick='bomtrrem(this)' class='btn btn-default btn-sm'>删除</button></td>";
        trs+="</tr>";
        $("#bomtbody").append(trs);
    }

    //删除不需要的物料
         function bomtrrem(obj){
        $(obj).parents("tr").remove();
                               }

//将所选物料添加到主界面
          function addbomcon(){
        $("#supcontent").html('');
              //$("#bomcontent").html("");
              var trle=$("#xmbbody tr");
             // alert(trle.length);
              //alert(parseInt(trle.length)-1);
              //颜色name+id
              var selects="<select><option value='0'>ALL</option>";
             for (var i=0;i<parseInt(trle.length);i++){

                  //第几个tr的td
                  var tds=trle.eq(i).find("td");
                  //得到input
                  //alert(tds.eq(0).find("input").val());
                  //alert(tds.eq(1).find("input").val());

                  selects+="<option value="+tds.eq(0).find("input").val()+">"+tds.eq(1).find("input").val()+"</option>";
              } ;
             selects+="</select>";
             //尺码
             var cmsel="<select><option value='0'>ALL</option>";
              chval.forEach(function(value,key){
                  cmsel+="<option value="+key+">"+value+"</option>";
              });
              cmsel+="</select>";
             /* $("#xmbbody").find("tr").each(function(){
                  var tdarr=$(this).children();
                  alert(tdarr.eq(1).find("input").val());
              })*/
         /*     for (var i=0;i<trle-1;i++){
                  alert($("#xmbbody").find("tr td").find("input[name='yansename']").value);
              }*/
              /*$("#xmbbody tr").each(function(){
yansename
                  alert($(this).find("td input:eq(0)").val());
              })*/
        //td的个数 用这个值每隔一行会出现未定义
              var tdle= $("#bomtbody").find("tr").find("td").length;
              var trs="";
             $("#bomtbody tr").each(function(){
                 trs+="<tr>";
                 trs+="<td>"+selects+"</td>";
                 trs+="<td>"+cmsel+"</td>";
                  for (var i=0;i<7;i++){
                      if (i==0){
                          trs+="<td style='display:none'>"+$(this).find("td:eq("+i+")").html()+"</td>";
                      }else{
                          trs+="<td>"+$(this).find("td:eq("+i+")").html()+"</td>";
                      }

                  }
                  trs+="<td><input class='wuliaosum' onkeyup=\"value=value.replace(/^(0+)|[^\\d]+/g,'')\"/></td>";
                  trs+="<td><button class='btn btn-default btn-sm' onclick='bomcondel(this)'>删除</button></td>";
                  trs+="</tr>";
              })
              $("#bomcontent").append(trs);

                               }

      //bomcontent删除选中行
      function bomcondel(obj){
        $(obj).parents("tr").remove();
      }


      //提交excel   filesub
      function fileduqu(){
          var formData = new FormData(document.getElementById("filesub"));
          $.ajax({
              url:"/consele/seleExcel",
              //contentType:"multipart/form-data",
              //enctype:"multipart/form-data",
              type:"post",
              dataType:"json",
              data:formData,
              async : false,  //异步
              cache : false,  //
              contentType : false, //
              processData : false,  //
              success:function(data){
                  //alert(data.body);
              }
          })
      }



   //全选全不选
   $("#selecteAll").click(function(){

       if(this.checked){
           $(".qqqq").each(function(){
               this.checked=true;
           });
       }else{
           $(".qqqq").each(function(){
               this.checked=false;
           });
       }
   });


   //CheckBox本身选择
   function  xuanze(xx){
       if(xx){
           $(".qqqq").each(function(){
               if (!this.checked){
                   $("#selecteAll").attr("checked",false);
                   return false;
               }else{
                   $(".seall").each(function(){
                       this.checked=true;
                   })
               }
           })
       }if (!xx){
           $(".qqqq").each(function(){
               if (this.checked){
                   $("#selecteAll").attr("checked",false)
                   return false;
               }else{
                   $("#selecteAll").attr("checked",true);
               }
           })
       }
   }
</script>